﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Zen4SyncDashboard.ViewModel
{
    public abstract class BaseViewModel : INotifyPropertyChanged
    {
        public string WorkStatus { get; private set; }

        protected void SetWorkStatus(bool isWorking)
        {
            string status = isWorking ? "Working..." : "Ready";
            SetWorkStatus(status);
        }

        protected void SetWorkStatus(string status)
        {
            WorkStatus = status;
            OnPropertyChanged("WorkStatus");
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                var e = new PropertyChangedEventArgs(propertyName);
                handler(this, e);
            }
        }
    }
}
